<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024/12/18 0018
  Time: 14:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>产品档次级别设置</title>
    <link rel="stylesheet" href="/bootstrap/bootstrap-5.3.3-dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/css/ProductDesign/product_archives_query.css" />
    <link rel="stylesheet" href="/css/ProductDesign/product_grade_level.css">
</head>
<body>
<div class="panel product">
    <div class="panel-heading hhead">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <span style="color: blue;">您正在做的业务是：</span>
                <li class="breadcrumb-item"><a href="#">客户化设置</a></li>
                <li class="breadcrumb-item active" aria-current="page"><a href="">产品档案管理设置</a></li>
                <li class="breadcrumb-item active" aria-current="page">产品档次级别设置</li>
            </ol>
        </nav>

    </div>
    <div style="margin-bottom: 2px">
        <div style="display: inline;margin-left: 88%;">
            <button class="btn btn-primary">添加</button>
            <button class="btn btn-primary">删除</button>
        </div>
    </div>

    <div class="panel-body bbody">
        <table id="tab" >
            <thead>
                <tr style="background-color: #e8e8e8;">
                    <th class="col1"></th>
                    <th class="col2">产品档次级别</th>
                </tr>
            </thead>
            <tbody id="template" style="display: none">
                <tr>
                    <td class="id"><input class="gradeID" type="checkbox"/></td>
                    <td class="gradeName"></td>
                </tr>
            </tbody>
            <tbody id="levelITbl">

            </tbody>
        </table>
    </div>

    <div class="panel-footer ffooter">
        <div id="footerDiv">
            <label style="font-weight: 700;">总数：<span style="color: red;">5</span>例&nbsp;&nbsp;&nbsp;&nbsp;
                当前第<span style="color: red;">1</span>页&nbsp;&nbsp;&nbsp;&nbsp;
                共<span style="color: red;">1</span>页&nbsp;&nbsp;&nbsp;&nbsp;
            </label>
        </div>

    </div>
</div>

<script type="text/javascript" src="/js/jquery-3.7.0.min.js"></script>
<script type="text/javascript" src="/bootstrap/bootstrap-5.3.3-dist/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript">
    $(function () {
        //初始化页面
        initGrade();
    })

    function initGrade() {
        $.ajax({
            url: "/d-grade/initialGrade",
            type: "get",
            dataType: "json",
            success: function (data) {
                console.log(data);
                $("#levelITbl").empty();
                let template = $("#template").children();

                $.each(data, function (i, levelI) {
                    let tr = template.clone();
                    $.each(levelI,function (name,value) {
                        if(name=="id"){
                            tr.find(".gradeID").val(value);
                            tr.find(".gradeID").attr("name",name);
                        }else{
                            tr.find("." + name).text(value);
                        }
                    })
                    $("#levelITbl").append(tr);
                })
            }
        })
    }
</script>
</body>
</html>
